/*
 * Copyright 2012 Faculty of Informatics - Masaryk University.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.muni.fi.pa165.creatures.dao.web;

import cz.muni.fi.pa165.creatures.model.web.Person;
import java.util.List;

/**
 * This interface represents a contract for implementation of the DAO for the
 * {@link cz.muni.fi.pa165.creatures.model.web.Person} entity.
 *
 * @author xmiklos1
 */
public interface PersonDAO {

    /**
     * Creates a new person.
     *
     * @param person a person to be created
     * @return id of just created person
     */
    Long create(Person person);

    /**
     * Updates an existing person.
     *
     * @param person a person to be updated
     */
    void update(Person person);

    /**
     * Removes an existing person.
     *
     * @param person a person to be removed
     */
    void remove(Person person);

    /**
     * Gets a person by its id.
     *
     * @param id id of the wanted person
     * @return the person with the given {@code id} or null if a person doesn't
     * exist
     */
    Person get(Long id);

    /**
     * Gets count of all persons.
     *
     * @return number of all persons
     */
    Long getCount();

    /**
     * Gets all persons.
     *
     * @return list of all persons
     */
    List<Person> getAll();

    /**
     * Removes all existing persons.
     */
    void removeAll();

    /**
     * Gets person by its name.
     *
     * @param name name of a person to get
     * @return person of a specified name
     */
    Person getByName(String name);
}
